using System;
using System.IO;
using System.Web.UI;

namespace ScottCateAjax2008.Lesson04
{
    public partial class Z_RealWorld : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            PH1.Controls.Clear();
            PH1.Controls.Add(new LiteralControl(GetContent()));
        }

        private string GetContent()
        {
            string path = "~/Lesson04/Z_RealWorld.aspx.txt";
            path = Server.MapPath(path);
            string content = string.Empty;

            if(File.Exists(path))
            {
                content = File.ReadAllText(path);
            }
            return content;
        }
    }
}